﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LYJudge
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void CheckYear(object sender, EventArgs e)
        {
            String year_str;
            int year;
            year_str = textBox1.Text;
            Boolean result = int.TryParse(year_str, out year);
            if (result)
            {
                if (year < 0)
                {
                    label2.Text = "输入有误，不能输入负数！";
                    return;
                }
                if (year % 4 == 0)
                {
                    if (year % 100 == 0)
                    {
                        label2.Text = "平年";
                        return;
                    }
                    label2.Text = "闰年";
                    return;

                }
                label2.Text = "平年";
                return;
            }
            else {
                label2.Text = "输入有误，请输入数字！";
            }
                
            
        }
    }
}
